package demo;

import demo3.Contoller.MyController;
import demo3.Mapper.MyMapper;
import demo3.Repository.MyRepository;
import demo3.Service.MyService;
import demo3.pojo.Person;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Test {
    public static void main(String[] args) {
//        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext("demo");
//        DBUtil bean = context.getBean(DBUtil.class);
//        System.out.println(bean.getUrl());
//        System.out.println(bean.getUsername());
//        System.out.println(bean.getPassword());
//        System.out.println(bean);
//        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext("demo2");
//        UserController controller = context.getBean(UserController.class);
//        controller.start();
        AnnotationConfigApplicationContext context1 = new AnnotationConfigApplicationContext("demo3");
        MyController bean = context1.getBean(MyController.class);
        System.out.println(bean);
        context1.getBean(MyService.class);
        context1.getBean(MyRepository.class);
        Person bean1 = context1.getBean(demo3.pojo.Person.class);
        Person bean2=context1.getBean(Person.class);
        System.out.println(bean1==bean2);
        System.out.println(bean1);



    }

}
